#include "myalert.h"
#include "ui_myalert.h"

MyAlert::MyAlert(QWidget *parent)
    : QDialog(parent)
    , ui(new Ui::MyAlert)
{
    ui->setupUi(this);

    //样式
    this->setStyleSheet("background-color:#f7f7f7;border:0px;QTabWidget::pane { border: 0; }");
    this->setWindowFlags(Qt::FramelessWindowHint);
    this->setWindowOpacity(0.95);

    //关闭按钮
    ui->closeButton->setStyleSheet("background-color:#2982f7;color:white;border-radius:4px;padding-bottom:3px;");
}

MyAlert::~MyAlert()
{
    delete ui;
}

void MyAlert::on_closeButton_clicked()
{
    this->close();
}

void MyAlert::setTitle(QString title){
    this->title = title;
}

void MyAlert::setMsg(QString msg){
    this->msg = msg;
}

void MyAlert::setButtonContent(QString bc){
    this->buttonContent = bc;
}

int MyAlert::exec(){
    ui->label->setText(this->title);
    ui->msg->setText(this->msg);
    ui->closeButton->setText(this->buttonContent);
    return QDialog::exec();
}
